home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: in2.uu.net!world!mv!usenet
- From: ENGR@GSSI.MV.COM (Michael Furman)
- Subject: Re: Advanced C++ question...
- Message-ID: <DoMH88.5wv@mv.mv.com>
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- Organization: GSSI
- Date: Thu, 21 Mar 1996 14:50:32 GMT
- References: <4iprfg$1ui@aadt>
- X-Newsreader: WinVN 0.99.7
- X-Nntp-Posting-Host: gssi.mv.com
-
- In article <4iprfg$1ui@aadt>, david_hooker@sdt.com says...
- >
- >Hi all...
- >
- >I want to write an operator* for a class, but I want to do
- >one of 2 things:
- > 1. Call one of two different operator*'s depending on whether
- > it is an lvalue or rvalue
- > OR
- > 2. Somehow determine in the function if it is being used as an
- > lvalue or an rvalue.
- >
- >For instance, I want to know, in the operator*, from which case I'm
- >being called:
- >
- > *Object = SomeValue; // used as an lvalue
- >
- > SomeValue = *Object; // used as an rvalue
- >
- >
- >The reason for this is that this class accesses data differently
- depending
- >on if it is a read or write access.
-
- It is impossible with "*" operator. But you can define conversion
- functions
- for your class - it will allow exactly what you need.
-
- >
- >Thanks...
- >
- >-dave-
- >
- >
- >
- >
-
- --
- <<< If you received it by E-mail: it is a copy of post to the newsgroup
- >>>
- ---------------------------------------------------------------
- Michael Furman, (603)893-1109
- Geophysical Survey Systems, Inc. fax:(603)889-3984
- 13 Klein Drive - P.O. Box 97 engr@gssi.mv.com
- North Salem, NH 03073-0097 71543.1334@compuserve.com
- ---------------------------------------------------------------
-
-